import os
import unittest
from cases.Base_Case import BASECASE
from config.config import DATA_PATH
from page.index import IndexPage
from page.住院公用页面.dianzhibingli__page import Binlibianjiqi
from page.住院护士站.住院护士站.chuyuan__page import chuyuan
from page.住院护士站.住院护士站.hulijilu__page import hulijibie
from page.住院护士站.住院护士站.yizhuxinxi__page import yizhuxinxi
from page.住院护士站.住院护士站.yizhuzhixing__page import yizhuzhixing
from page.住院护士站.住院护士站.zhuyuanhushizhan__page import zhuyuanhushizhan
from page.住院护士站.住院护士站.zidongjifei__page import zidongjifei
from tools.sjqd_way import read_data_from_excel
from page.住院护士站.住院护士站.feiyongbulu__page import feiyongbulu
class TestZhuyuanhushizhan(BASECASE):
    #安排床位
    @unittest.skip
    def  test_1_zhuyuanhushizhan_anpaichuangwei(self):
        self.data = read_data_from_excel(os.path.join(DATA_PATH, "datas.xls"), "住院护士站安排床位")
        bq,zzys,sjys,kzr,zrhs = self.data[0]
        ap = IndexPage()
        bp = zhuyuanhushizhan()
        ap.jrym_no1('住院护士站')
        bp.choose_bq(bq)                    # 选择病区
        bp.ckick_apcw(zzys,sjys,kzr,zrhs)   # 安排床位

    #执行医嘱
    @unittest.skip
    def test_2_zhuyuanhushizhan_zhixingyizhu(self):
        self.data = read_data_from_excel(os.path.join(DATA_PATH, "datas.xls"), "测试患者")
        name = self.data[0][0]
        ap = IndexPage()
        bp = zhuyuanhushizhan()
        ap.jrym_no1('住院护士站')
        bp.input_hzxx(name)  #输入住院患者姓名
        self.data = read_data_from_excel(os.path.join(DATA_PATH, "datas.xls"), "执行医嘱")
        bq,ks,yzfl,yzzt,yz1,yz2=self.data[0]
        bp.choose_bq(bq)  # 选择病区
        bp.click_cx_btn() #点击查询按钮
        bp.click_yzzx_btn()  #点击医嘱执行按钮
        cp = yizhuzhixing()
        cp.choose_ks(ks)#选择科室
        cp.choose_yzfl(yzfl)#选择医嘱分类
        cp.choose_yzzt(yzzt)#选择医嘱状态
        cp.input_hzxm(name)#输入患者姓名
        cp.execute_yz(yz1)
        cp.click_tsqx_btn()#点击提示取消按钮
        cp.execute_yz(yz2)
        cp.click_tsqx_btn()  # 点击提示取消按钮
        cp.close_window()#关闭窗口
    #添加自动收费
    @unittest.skip
    def test_3_zhuyuanhushizhan_add_zidongjifei(self):
        self.data = read_data_from_excel(os.path.join(DATA_PATH, "datas.xls"), "自动计费")
        zdjf = self.data[0][0]
        bp = zhuyuanhushizhan()
        bp.ckick_zdjf()#点击自动计费
        cp = zidongjifei()
        cp.click_xz_btn()#点击新增
        cp.choose_xm(zdjf)
        cp.click_add()#点击添加按钮
        cp.click_tj()#点击提交
        cp.close_window()#关闭窗口
    #停止自动收费
    @unittest.skip
    def test_4_zhuyuanhushizhan_close_zidongjifei(self):
        bp = zhuyuanhushizhan()
        bp.ckick_zdjf()#点击自动计费
        cp = zidongjifei()
        cp.click_qx()#点击全选
        cp.click_tz_btn()#点击停止
        cp.click_tsqd()#点击提示确定按钮
        cp.close_window()#关闭窗口
    #添加护理级别
    @unittest.skip
    def test_5_zhuyuanhushizhan_add_hulijibie(self):
        self.data = read_data_from_excel(os.path.join(DATA_PATH, "datas.xls"), "护理级别")
        hljb = self.data[0][0]
        bp = zhuyuanhushizhan()
        bp.click_hljb()
        cp = hulijibie()
        cp.input_hljb(hljb)#变更护理级别
        cp.click_bc_btn()#点击保存
    #停止护理级别
    @unittest.skip
    def test_6_zhuyuanhushizhan_close_hulijibie(self):
        self.data = read_data_from_excel(os.path.join(DATA_PATH, "datas.xls"), "护理级别")
        hljb = self.data[6][0]
        bp = zhuyuanhushizhan()
        bp.click_hljb()
        cp = hulijibie()
        cp.input_hljb(hljb)#变更护理级别
        cp.click_bc_btn()#点击保存
    #添加电子病历记录
    @unittest.skip
    def test_7_zhuyuanhushizhan_add_dianzibingli(self):
        self.data = read_data_from_excel(os.path.join(DATA_PATH, "datas.xls"), "电子病历")
        mbmc,pwd = self.data[1]
        bp = zhuyuanhushizhan()
        bp.chuangwei1.Click()
        bp.click_dzblln_btn()   # 点击电子病历
        cp = Binlibianjiqi()
        cp.click_xz_btn()       # 点击新增按钮
        cp.click_yymb()         # 点击医院模板
        cp.input_mbmc(mbmc)
        cp.click_cz_btn()       # 点击查询
        cp.click_shuju1()       # 点击第一条模板
        cp.click_qd_btn()       # 点击确定按钮
        cp.qianming_(pwd)       # 签名
    #冲减补录
    @unittest.skip
    def test_8_zhuyuanhushizhan_feiyongbulu(self):
        self.data = read_data_from_excel(os.path.join(DATA_PATH, "datas.xls"), "冲减补录")
        A,B,C = self.data[0][0]
        bp = zhuyuanhushizhan()
        cp = feiyongbulu()
        bp.click_fybl()#点击费用补录
        cp.input_xmmc(A)
        cp.click_dw_btn()#点击定位
        cp.clik_cj_first()#冲减第一条数据
        cp.click_cjqd()#点击冲减确定
        cp.input_xmmc(B)
        cp.click_dw_btn()  # 点击定位
        cp.clik_cj_last()#冲减最后一条数据
        cp.click_cjqd()#点击冲减确定
        cp.add_sfxm(2)#添加项目
        cp.choose_last_xmmc(C)
        cp.click_zc_btn()#点击暂存
        cp.click_tj_btn()#点击提交
    #停止长期医嘱
    @unittest.skip
    def test_9_zhuyuanhushizhan_tingchangqiyizhu(self):
        self.data = read_data_from_excel(os.path.join(DATA_PATH, "datas.xls"), "测试患者")
        name = self.data[0][0]
        ap = IndexPage()
        bp = zhuyuanhushizhan()
        cp=yizhuxinxi()
        ap.jrym_no1('住院护士站')
        bp.input_hzxx(name)  #输入住院患者姓名
        self.data = read_data_from_excel(os.path.join(DATA_PATH, "datas.xls"), "执行医嘱")
        bq,ks,yzfl,yzzt,yz1,yz2=self.data[0]
        bp.choose_bq(bq)  # 选择病区
        bp.click_cx_btn() #点击查询按钮
        bp.click_yzxx()#点击医嘱信息
        cp.click_cqyz()#点击长期医嘱
        cp.click_zxyz_btn()#点击执行医嘱
        cp.click_zx_btn()#点击执行按钮
        cp.click_wxts_s()#点击提示是
        cp.close_window_yzzx()#关闭医嘱执行窗口
        cp.close_window_yzxx()#关闭医嘱信息窗口
    #出院
    # @unittest.skip
    def test_10_zhuyuanhushizhan_chuyuan(self):
        self.data = read_data_from_excel(os.path.join(DATA_PATH, "datas.xls"), "测试患者")
        name = self.data[0][0]
        ap = IndexPage()
        bp = zhuyuanhushizhan()
        cp = chuyuan()
        ap.jrym_no1('住院护士站')
        bp.input_hzxx(name)  #输入住院患者姓名
        self.data = read_data_from_excel(os.path.join(DATA_PATH, "datas.xls"), "执行医嘱")
        bq,ks,yzfl,yzzt,yz1,yz2=self.data[0]
        bp.choose_bq(bq)  # 选择病区
        bp.click_cx_btn() #点击查询按钮
        bp.click_cy()#点击出院
        self.data = read_data_from_excel(os.path.join(DATA_PATH, "datas.xls"), "出院")
        cyzt,lyfs,zzyjh= self.data[0]
        cp.choose_cyzt(cyzt)
        cp.choose_lyfs(lyfs)
        cp.choose_zzyjh(zzyjh)
        cp.all_click()
        cp.click_cy()

if __name__ == '__main__':
    unittest.main()
